﻿// JScript 文件
var txtjbo = new Array("", "supply", "purchase", "company", "agent", "expo", "know", "job");
var objpath = window.location.pathname;
objpath = objpath.toLowerCase().replace('marketsales', 'expo');
if (objpath.toLowerCase().indexOf('supply') > 0) {
    document.getElementById('企业').className = "sotli2";
    document.getElementById('供应').className = "sotli1";
}

if (objpath.toLowerCase().indexOf('purchase') > 0) {
    document.getElementById('企业').className = "sotli2";
    document.getElementById('求购').className = "sotli1";
}


var id = 0;
for (var i = 0; i <= txtjbo.length; i++) {
    if (objpath.toLowerCase().indexOf(txtjbo[i]) > 0) {
        id = i;
    }
}
for (var i = 0; i <= txtjbo.length; i++) {
    if (i == id) {
        if (document.getElementById("li" + i) != null) {
            document.getElementById("li" + i).className = "navli2";
        }
    }
    else {
        if (document.getElementById("li" + i) != null) {
            document.getElementById("li" + i).className = "navli1";
        }
    }
}


if (getCookie("LoginName") != null && getCookie("LoginName") != "") {
    document.getElementById('p_log1').style.display = 'none';
    document.getElementById('p_log2').style.display = 'block';
    document.getElementById('cookiename').innerHTML = getCookie("LoginName");
}
if (jQuery("#so")) {
    jQuery("#so").find("li").mouseover(function() {
        jQuery("#so").find("li").removeClass().addClass("sotli2");
        jQuery(this).removeClass().addClass("sotli1");
    });
}

function minosearch() {
    var type = document.getElementById('so').getElementsByTagName("li");
    var typename = "";
    var keyword = document.getElementById('keyword').value;
    for (var i = 0; i < type.length; i++) {
        if (type[i].className == 'sotli1') {
            typename = type[i].id;
        }
    }
    if (typename == "供应") {
        if (keyword != "" && keyword != '请输入搜索内容') {
            window.location.href = webroot + 'supply/trade' + webpfix + '?sName=' + escape(keyword) + '';
        }
        else {
            window.location.href = webroot + 'supply/trade' + webpfix;
        }
    }
    if (typename == "求购") {
        if (keyword != "" && keyword != '请输入搜索内容') {
            window.location.href = webroot + 'purchase/trade' + webpfix + '?sName=' + escape(keyword) + '';
        }
        else {
            window.location.href = webroot + 'purchase/trade' + webpfix;

        }
    }
    if (typename == "企业") {
        if (keyword != "" && keyword != '请输入搜索内容') {
            window.location.href = webroot + 'company/trade' + webpfix + '?sName=' + escape(keyword) + '';
        }
        else {
            window.location.href = webroot + 'company/trade' + webpfix;

        }
    }
    if (typename == "资讯") {

    }
}